package com.bupt.ilink.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bupt.ilink.entity.DatasetTags;
import com.bupt.ilink.service.DatasetTagsService;
import com.bupt.ilink.mapper.DatasetTagsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author LENOVO
 * @description 针对表【dataset_tags】的数据库操作Service实现
 * @createDate 2024-07-25 17:53:59
 */
@Service
public class DatasetTagsServiceImpl extends ServiceImpl<DatasetTagsMapper, DatasetTags>
        implements DatasetTagsService{

    @Autowired
    private DatasetTagsMapper datasetTagsMapper;

    @Override
    public List<DatasetTags> getTagsByTags(String tag) {
        return baseMapper.selectByTags(tag);
    }

    @Override
    public List<DatasetTags> getTagsByDatasetId(Long datasetId) {
        return baseMapper.selectByDatasetId(datasetId);
    }

    //  数据集统计
    @Override
    public long getTagsCount() {
        // 使用查询来获取标签的种类总数
        return datasetTagsMapper.selectTagsCount();
    }

    @Override
    public List<String> getCommonTags() { return datasetTagsMapper.selectCommonTags(); }
}



